<template>
  <div style="">
    <!-- 卸车作业首页 2018/7/17 zhangQ -->
    <navbar>
      <mu-button slot="left" icon @click="backHome">
        <mu-icon size="36" value="home"></mu-icon>
      </mu-button>
    </navbar>
    <div class="head">
      <mu-container style="padding: 35px 0;">
        <mu-row justify-content="center">
          <mu-avatar :size="150">
            <img :src="currentUser.headIco">
          </mu-avatar>
        </mu-row>
      </mu-container>
    </div>

    <div class="weui-grids">
      <div class="weui-grid" v-if="item.parentId===97" v-for="item, index in list" :key="index" @click="goToOtherPage(item.name)">
        <div class="weui-grid__icon">
          <img :src="item.icon" alt="">
        </div>
        <p class="weui-grid__label">{{ item.title }}</p>
      </div>
    </div>
    <!--{{ currentToken }}-->
    <div class="footer" v-power="'index-footer'"></div>
  </div>
</template>

<script>
  // import utils from '@/components/apiCloudUtil/utils'
  import {mapGetters} from 'vuex'

  function funIniGroup () {
    api.closeWin()
  }

  console.log('UIMultiSelector要实例化')
  export default {
    name: 'index',
    data () {
      let list = [
        // {icon: 'http://oss.x-link.cc/ico/20180412_115533_995574.jpg', title: '到站卸车-核对', name: 'checkUnload'},
        // {icon: 'http://oss.x-link.cc/ico/20180412_115533_995574.jpg', title: '到站卸车', name: 'unload'},
        {image: 'http://oss.x-link.cc/ico/20180412_115533_995574.jpg', name: 'login', title: '登录', author: 'zhangQ'}
        // {image: 'http://oss.x-link.cc/ico/20180412_115533_995574.jpg', title: '通知货主', author: 'zhangQ'},
        // {image: 'http://oss.x-link.cc/ico/20180412_115533_995574.jpg', title: '打印单据', author: 'zhangQ'}
      ]
      let datas = {list}
      return datas
    },
    computed: {
      ...mapGetters(['activeMenu', 'currentUser', 'currentToken'])
    },
    methods: {
      onSwiperight () {
        console.log('右滑动')
      },
      tete1 () {
        this.$loading()
        // setTimeout(() => {
        //   loading.close()
        // }, 2000)
      },
      backHome () {
        funIniGroup()
      },
      goToOtherPage (name) {
        this.$router.push({name})
        // let UIMultiSelector = utils.UIMultiSelector()
        // UIMultiSelector.open({
        //   bg: '#FFF',
        //   rect: {
        //     h: api.winHeight - 200
        //   },
        //   text: {
        //     title: '选择送货地址',
        //     leftBtn: '取消',
        //     rightBtn: '完成',
        //     selectAll: '全选'
        //   },
        //   max: 0,
        //   styles: {
        //     mask: 'rgba(0,0,0,0.3)',
        //     title: {
        //       bg: '#ffffff',
        //       color: '#4585F5',
        //       lineColor: '#ccc',
        //       size: 16,
        //       h: 44
        //     },
        //     leftButton: {
        //       w: 80,
        //       h: 35,
        //       marginT: 5,
        //       marginL: 8,
        //       bg: '#FFFFFF',
        //       color: '#000000',
        //       size: 14
        //     },
        //     rightButton: {
        //       w: 80,
        //       h: 35,
        //       marginT: 5,
        //       marginR: 8,
        //       bg: '#4585F5',
        //       color: '#FFFFFF',
        //       size: 14
        //     },
        //     item: {
        //       h: 35,
        //       bg: '',
        //       bgActive: '#FFFFFF',
        //       color: '#000000',
        //       active: '#000000',
        //       size: 14,
        //       lineColor: '#fff',
        //       textAlign: 'left'
        //     },
        //     icon: {
        //       w: 20,
        //       h: 20,
        //       marginT: 11,
        //       marginH: 8,
        //       bg: 'widget://img/img_nocheck.png',
        //       bgActive: 'widget://img/img_check.png',
        //       bgHighlight: 'widget://img/img_check.png',
        //       align: 'left'
        //     }
        //   },
        //   animation: true,
        //   items: [{ status: 'selected' }, { status: 'selected' }, { status: 'selected' }, { status: 'selected' }]
        // }, function (ret, err) {
        //   if (ret) {
        //     if (ret.eventType === 'clickRight') {
        //       UIMultiSelector.close()
        //     }
        //     if (ret.eventType === 'clickLeft') {
        //       UIMultiSelector.close()
        //     }
        //   } else {
        //   }
        // })
      }
    },
    created () {
      this.list = this.currentUser.appPower
    },
    mounted () {
    },
    components: {}
  }
</script>

<style scoped>
  .weui-grid__icon {
    width: 50px;
    height: 50px;
  }

  .head {
    background: #4585F5;
    height: 42.3%;
  }

  .img_appicon {
    /*background-color: #4585F5;*/
    top: 20.5%;
    position: absolute;
    text-align: center;
    width: 100%;
  }

  .footer {
    position: absolute;
    text-align: center;
    width: 100%;
    bottom: 15px;
  }
</style>
